<?php
	require_once 'loginSuccess.php';
	
	function getUserInfo($username) {
		global $dbConnection;
		$query = "Select username as 'Username', 
				birthDate as 'Date of Birth', 
				e_mail as 'Email' 
				from users 
				where username = '$username';";
		$statement = $dbConnection->execute($query);
		$userInfo = $statement->fetch_assoc();
		return $userInfo;
	}
	
	function displayUserInfo($userInfo) {
		echo "<table id='userProfileTable'>";
		foreach ($userInfo as $key => $value) {
			echo "<tr><td>$key</td><td>$value</td></tr>";
		}
		echo "</table>";
	}
	
	$userInfo = getUserInfo($_SESSION['username']);
	displayUserInfo($userInfo);
?>